package com.mew.chess.core.game.pokdeng.game.task;

import com.mew.chess.core.common.handler.ChessPushMessageUtil;
import com.mew.chess.core.game.pokdeng.game.PokDengGameManager;
import com.mew.chess.core.game.pokdeng.game.PokDengTableManager;
import com.mew.chess.core.game.pokdeng.game.common.PokDengConstantValue;
import com.mew.chess.core.game.pokdeng.game.common.PokDengLinkType;
import com.mew.chess.core.game.pokdeng.game.common.PokDengPushCMDMapType;
import com.mew.chess.core.game.pokdeng.game.message.PushMiCardMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author dylin
 * @create 2021/4/29
 */
@Component
@Slf4j
public class PokDengMiCardTask {
    public void miCard(int roomId,int tableId){
        PokDengTableManager table = PokDengGameManager.getInstance().getController(roomId).getTableManager(tableId);
        table.changeLink(PokDengLinkType.MiCard.code(), PokDengConstantValue.MI_CARD_TIME);
        PushMiCardMessage pushMiCardMessage=table.getPushMiCardMessage();
        ChessPushMessageUtil.broadcastMessage(table.getOnlineUser().values(),
                PokDengPushCMDMapType.MiCardMessage.code(), pushMiCardMessage);
    }
}
